<?php
session_start();
//判断当前是否处于登录状态
if(!isset($_SESSION['loggedUsername']) || $_SESSION['loggedUsername'] == ''){
    //说明未登录，或者登录无效，或者登录超时
    echo "<script>alert('请登录后访问本页面');location.href='login.php';</script>";
    exit;
}